package com.hsh.web;

import com.hsh.bean.Blog;
import com.hsh.service.ClickFavorService;
import com.hsh.service.impl.ClickFavorServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(value = "/clickFavor")
public class ClickFavorServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int bid = Integer.parseInt(req.getParameter("bid"));
        resp.setContentType("text/html;charset=utf-8");
        ClickFavorService clickFavorService = new ClickFavorServiceImpl();
        int favor = clickFavorService.clickFavor(bid);
        PrintWriter out = resp.getWriter();
        out.print(favor);
        out.close();
    }
}
